<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            display: flex; /* 弹性布局 */
            justify-content: space-around; /* 水平居中 */
            align-items: center; /* 垂直居中 */
            flex-direction: column; /* 垂直排列 */

        }
        #id1{
            width: 30px;
            height: 30px;
            background-color: rgb(252, 220, 220);
        }
        #id2{
            width: 400px;
            height: 400px;
            background-color: rgb(214, 214, 249);
            display: flex; /* 弹性布局 */
            flex-direction: column; /* 垂直排列 */
            justify-content: center; /* 水平居中 */
            align-items: center; /* 垂直居中 */
            margin-top: 20px;
        }
        #id3{
            width: 250px;
            height: 250px;
            background-color: rgb(239, 255, 239);
            display: flex; /* 弹性布局 */
            flex-direction: column; /* 垂直排列 */
            justify-content: center; /* 水平居中 */
            align-items: center; /* 垂直居中 */
        }
        #id4{
            width: 100px;
            height: 100px;
            background-color: rgb(175, 215, 175);
        }

    </style>
</head>
<body>
    <div id="id1" draggable="true"></div>
    <div id="id2">
        <div id="id3">
            <div id="id4"></div>
        </div>
    </div>


    <script>
        const div1 = document.getElementById("id1");
        const div2 = document.getElementById("id2");
        const div3 = document.getElementById("id3");
        const div4 = document.getElementById("id4");

        div1.addEventListener("dragstart", e =>{
            // console.log(e.target);
            console.log(1);

        })

        div4.addEventListener('dragenter' , e =>{
            e.preventDefault();
            // console.log(e.target);
            console.log(2);
        })

        div4.addEventListener('dragend' , e =>{
            console.log(3);

        })

        div4.addEventListener('dragover' , e =>{
            e.preventDefault();
            // console.log(e.target);
            console.log(4);
        })


        
        
    </script>
</body>
</html>